package inline;

import android.content.Context;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.app.Fragment;

import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.utility.UIUtils;
import com.bytedance.common.utility.collection.WeakHandler;
import com.ss.android.account.Spipe;
import com.ss.android.account.model.ActionData;
import com.ss.android.account.model.SharePlatform;
import com.ss.android.article.browser.R;
import com.ss.android.model.AbsArticle;

import org.jetbrains.annotations.NotNull;

import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public final class TempBean implements WeakHandler.Callback {
    public final WeakReference a = null;
    public final String b = null;
    public final Class c = null;
    public final Bundle d = null;
    public Fragment e;
    public final ScreenshotListener f = null;
    public final RectF g = null;
    public final Paint h = null;
    public int i;
    public final Paint j = null;
    public int k;
    public boolean l;

    TempBean() {

    }

    @NotNull
    public final Iterator A() {
//            Ref$BooleanRef v1 = new Ref$BooleanRef();
//            v1.element = false;
//            SequencesKt___SequencesKt$minus$1$iterator$1 v0 = new SequencesKt___SequencesKt$minus$1$iterator$1(this, v1);
//            m.b(null, "$receiver");
//            m.b(v0, "predicate");
//            return new kotlin.sequences.a(true, ((b)v0)).A();
        return null;
    }

    public static void a() {
//            null.invalidateDrawable(null);
//            null.invalidateDrawable(null);
//            null.invalidateDrawable(null);
    }

    private static void a(boolean arg12, ActionData arg13) {
        int v1;
        boolean v3 = false;
        Context v11 = null;
        boolean v2 = true;
        if (arg13 != null && arg13.mItem != null && (arg12)) {
            int v5 = Spipe.c(arg13.mAction);
            if (v5 <= 0) {
                return;
            }

            AbsArticle v6 = arg13.mItem;
            if (arg13.mPlats != null && !arg13.mPlats.isEmpty()) {
                if (arg13.mRepostSuccess) {
                    HashSet v7 = new HashSet();
                    if (!android.support.design.a.isTextEmpty(arg13.mExpiredPlatform)) {
                        try {
                            String[] v0_1 = arg13.mExpiredPlatform.split(",", -1);
                            if (v0_1 != null) {
                                ((Set) v7).addAll(Arrays.asList(((Object[]) v0_1)));
                            }
                            v1 = 1;
                        } catch (Exception v0) {
                            v1 = 1;
                        }
                    } else {
                        v1 = 0;
                    }
                    StringBuffer v8 = new StringBuffer();
                    Iterator v9 = arg13.mPlats.iterator();
                    int v4 = 1;
                    while (v9.hasNext()) {
                        Object v0_2 = v9.next();
                        if (((Set) v7).contains(((SharePlatform) v0_2).mName)) {
                            continue;
                        }

                        if (v4 == 0) {
                            v8.append(v11.getString(com.ss.android.article.browser.R.string.ss_send_success_delimiter));
                        } else {
                            v4 = 0;
                        }

                        v8.append(v11.getString(((SharePlatform) v0_2).mVerbose));
                    }

                    UIUtils.showImageToast(v11, R.drawable.close_popup_textpage, String.format(v11.getString(com.ss.android.article.browser.R.string.ss_send_success_pattern), v8));
                } else {
                    v1 = arg13.mPostError == 105 ? 1 : arg13.mPostError == 108 ? 1 : 0;
                }

                if (v1 != 0) {
//                        ((com.ss.android.account.h)v11).b(v11);
                }
            }

            if (!arg13.mSuccess) {
                com.ss.android.action.bb.a();
                com.ss.android.action.bb.a(v5, arg13.mTimeMillis, v6, false);
                return;
            }

            if (arg13.mDiggCount >= 0) {
                if (v6.diggCount < arg13.mDiggCount) {
                    v6.diggCount = arg13.mDiggCount;
                }

                v3 = true;
            }

            if (arg13.mBuryCount >= 0) {
                if (v6.buryCount < arg13.mBuryCount) {
                    v6.buryCount = arg13.mBuryCount;
                }

                v3 = true;
            }

            if (arg13.mLikeCount >= 0) {
                if (v6.likeCount < arg13.mLikeCount) {
                    v6.likeCount = arg13.mLikeCount;
                }

                v3 = true;
            }

            if (arg13.mRepinCount >= 0) {
                v6.repinCount = arg13.mRepinCount;
                if ((v6.userRepin) && v6.repinCount <= 0) {
                    v6.repinCount = 1;
                }

                v3 = true;
            }

            if (arg13.mCommentCount >= 0) {
                v6.commentCount = arg13.mCommentCount;
            } else {
                v2 = v3;
            }

            com.ss.android.action.bb.a();
            com.ss.android.action.bb.a(v5, arg13.mTimeMillis, v6, v2);
        }
    }

    public static boolean b() {
        String v1 = null;
        return 0 <= 0 || !TTUtils.isValidUrl(v1) || !TTUtils.isValidUrl(v1) || (android.support.design.a.isTextEmpty(v1)) ? false : true;
    }

    public final void handleMsg(Message message) {
        List v7 = null;
        boolean v1 = true;
        switch (message.what) {
            case 1005: {
                if (!(message.obj instanceof ActionData)) {
                    return;
                }

                a(v1, (ActionData) message.obj);
                break;
            }
            case 1006: {
                v1 = false;
                if (!(message.obj instanceof ActionData)) {
                    return;
                }

                a(v1, (ActionData) message.obj);
                break;
            }
            case 1033: {
                if (!(message.obj instanceof com.ss.android.account.b.f)) {
                    return;
                }

                int v5 = v7.size();
                int v4;
                for (v4 = 0; v4 < v5; ++v4) {
                    Object v0 = v7.get(v4);
                    boolean v3 = ((ActionData) v0).mMsgValue == 1005 ? true : false;
                    a(v3, ((ActionData) v0));
                }
            }
        }
    }
}